package ws.very.util.lang

trait WeekBooleanCookies {

  import java.{ lang => jlang }
  import java.{ util => jutl }
  @inline
  implicit def jIterableToBoolean[I <: jlang.Iterable[_]](x: I) = x != null && x.iterator().hasNext()
  @inline
  implicit def jMapToBoolean[I <: jutl.Map[_, _]](x: I) = x != null && !x.isEmpty()
  @inline
  implicit def iterableToBoolean(x: Iterable[_]) = x != null && !x.isEmpty
  @inline
  implicit def stringToBoolean(x: String) = x != null && !x.isEmpty
  @inline
  implicit def numberToBoolean[N <% Number](x: N) = x != null && x.intValue > 0
  @inline
  implicit def arrayToBoolean(x: Array[_]) = x != null && !x.isEmpty

}